how to find length of string in java without using length method